/*********************************************************************************
 *      Copyright:  (C) 2020 Juan
 *                  All rights reserved.
 *
 *       Filename:  socket_client.c
 *    Description:  This file 
 *                 
 *        Version:  1.0.0(13/07/20)
 *         Author:  wangruijie <1046299465@qq.com>
 *      ChangeLog:  1, Release initial version on "13/07/20 13:07:53"
 *                 
 ********************************************************************************/
#include<stdio.h>
#include<stdint.h>
#include<netinet/in.h>
#include<libgen.h>
#include<arpa/inet.h>
#include<fcntl.h>
#include<unistd.h>
#include<string.h>
#include<getopt.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<signal.h>
#include<errno.h>
#include<sys/types.h>
#include<sqlite3.h>

#define     BUFSIZE      1024

static void print_usage(const char *progname)
{
    printf("Usage: %s [OPTION]...\n", progname);
    printf("This program used to connect to server \n");

    printf("\nMandatory arguments to long options are mandatory for short options too:\n");
    printf(" -p[port    ]  Specify host server address and port, foramt as \"8889\"\n");
    printf(" -L[ip] into ipaddr, foramt as \"127.0.0.1\"\n");
    printf(" -h[help    ]  Display this help information\n");
    printf("\n");

    return;
}

int pack_json(char *json_buf);
int get_data_from_database(sqlite3 *db, char *json_buf);
int delete_data_from_database(sqlite3 *db);
int save_data_in_database(sqlite3 *db, char *json_buf);
sqlite3*  sqlite_init(char *json_client);
